﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Threading;

namespace BusinessRepository.sqlserver
{
    public class g
    {
        static Lazy<IFreeSql> sqlserverLazy = new Lazy<IFreeSql>(() => new FreeSql.FreeSqlBuilder()
       .UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=freesqlTest;Pooling=true;Max Pool Size=3")
       
       .UseAutoSyncStructure(true)
       //.UseGenerateCommandParameterWithLambda(true)
       .UseMonitorCommand(
           cmd => Trace.WriteLine("\r\n线程" + Thread.CurrentThread.ManagedThreadId + ": " + cmd.CommandText) //监听SQL命令对象，在执行前
                                                                                                            //, (cmd, traceLog) => Console.WriteLine(traceLog)
           )
       .UseLazyLoading(true)
       .Build());
        public static IFreeSql sqlserver => sqlserverLazy.Value;
    }
}
